home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-12 | 2.3 KB | 88 lines | [TEXT/ttxt] |
- -- *******************************************************
- -- * *
- -- * PrepareTransitionAction class *
- -- * *
- -- *******************************************************
-
- class PrepareTransitionAction (Action)
- instance variables
- transitionClass
- scoreTicker
- duration
- direction
- scale
- end
-
- method init self {class PrepareTransitionAction} #rest args #key transitionClass:(Wipe) \
- duration:(5) direction:(@left) scale:(1) ->
- (
- apply nextMethod self args
- self.transitionClass := transitionClass
- self.duration := duration
- self.direction := direction
- self.scale := scale
- )
-
- method trigger self {class PrepareTransitionAction} theTarget thePlayer ->
- (
-
- -- Save old rate and stop the animation
-
- if thePlayer.scorePlayer.effectiveRate = 0 do
- return self
-
- local ft := thePlayer.scorePlayer.scoreTicker
- thePlayer.scorePlayer.scoreTickerRate := ft.rate
- stop ft
-
- self.scoreTicker := ft
-
- -- Get the animation space and its parent
- local ts := thePlayer.stage
- local ps := ts.presentedBy
- local myCompositor := ps.compositor
-
- -- Disable the compositor so that the removal of the space
- -- is not seen by the compositor
- myCompositor.enabled := false
-
- -- BUG! What is presentedBy is undefined?
- deleteOne ps ts
- -- reenable the compositor. Too soon?
- myCompositor.enabled := true
-
-
- local tp := new (self.transitionClass) duration:self.duration target:ts \
- staticTarget:true direction:self.direction
-
- tp.scale := self.scale
-
- tp.masterClock := thePlayer.scorePlayer
-
- -- Add a callback to restart
- AddTimeCallback tp restartAnimation thePlayer.scorePlayer undefined self.duration true
-
- thePlayer.scorePlayer.transitionPlayer := tp
-
- -- Hopefully place in the same z location, provided the user set a z on the stage
- tp.z := ts.z
- prepend ps tp
- --tp.autoSplice := true
- tp.direct := true
- )
-
-
- -- This function starts a transition that had been setup by a PrepareTransitionAction
- -- This function is used by the ScriptActions that are created in the ScorePlayerScoreTranslator
-
- function ScorePlayerStartTransition self theTarget thePlayer ->
- (
- local tp := thePlayer.scorePlayer.transitionPlayer
-
- if tp <> undefined do
- (
- playPrepare tp 1.0
- play tp
- )
- )
-